package mgt.pages

import geb.Page

class LoginPage extends Page {
    static url = "/login/auth"

    static at = {
        title == "Login"
    }

    static content = {
        usernameField(wait: true) { $("#username") }
        passwordField(wait: true) { $("#password") }

        loginButton() { $("#submit") }
    }

    Page login(String username, String password) {
        usernameField.value(username)
        passwordField.value(password)

        loginButton.click()

        return browser.page
    }
}